﻿namespace Snake.FSM
{
    public class AndCondition<TOwner> : FsmCondition<TOwner>
    {
        private readonly FsmCondition<TOwner> _condition1;
        private readonly FsmCondition<TOwner> _condition2;

        public AndCondition(FsmCondition<TOwner> con1, FsmCondition<TOwner> con2)
        {
            _condition1 = con1;
            _condition2 = con2;
        }

        public override bool Condition(TOwner owner)
        {
            return _condition1.Condition(owner) && _condition2.Condition(owner);
        }
    }
}